<template>
  <c-checkbox-group
    v-bind="$attrs"
    v-on="$listeners"
    :value="value"
    :options="options"
    checkbox-class="d-block"
  ></c-checkbox-group>
</template>

<script>
export default {
  props: {
    value: {
      default: () => [],
    },
  },
  data() {
    return {
      options: [],
    }
  },

  created() {
    this.getData()
  },
  methods: {
    getData() {
      this.$api
        .getData('credit', 'scope_list_view', { 'org_class.eq': 'org_credit', 'is_outside.eq': 0 })
        .then(res => {
          this.options = (res?.data ?? []).map(item => {
            return {
              value: item.scope_value,
              label: `${item.scope_name}${+item.is_only_one === 1 ? '(唯一指定)' : ''}`,
            }
          })
        })
    },
  },
}
</script>
<style lang="scss" scoped></style>
